package com.tianqi.util;

import java.util.Date;

public class SerialCodeGenerator
{
	@SuppressWarnings("deprecation")
	public static String gen_serial_code ()
	{
		Date date = new Date();
		String date_string = "";
		date_string += String.format("%04d", date.getYear()+1900);
		date_string += String.format("%02d", date.getMonth()+1);
		date_string += String.format("%02d", date.getDate());
		date_string += "-";
		date_string += String.format("%02d", date.getHours());
		date_string += String.format("%02d", date.getMinutes());
		date_string += String.format("%02d", date.getSeconds());
		return date_string;
	}
	
	@SuppressWarnings("deprecation")
	public static String get_date_string ()
	{
		Date date = new Date();
		String date_string = "";
		date_string += String.format("%04d", date.getYear()+1900);
		date_string += String.format("%02d", date.getMonth()+1);
		date_string += String.format("%02d", date.getDate());
		return date_string;
	}
	
	public static void main (String[] args)
	{
		System.out.println(SerialCodeGenerator.gen_serial_code());
		System.out.println(SerialCodeGenerator.get_date_string());
	}
	
}

